# -*- coding: utf-8 -*-
import json
import codecs
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html


class NewszaobaoPipeline(object):
	def __init__(self):
		self.file = codecs.open("E:\jiaocheng\F\scrapy\NEWSzaobao\data\zaobao_list.json",'wb',encoding = 'utf-8')

	def process_item(self, item, spider):
		url_link = item['url_link']
		title = item['title'] 
		data = item['data']
		times = item['times'] 
		autho = item['autho']
		dic = {
	    	"title" : title,
	    	"data" : data,
	    	"url_link" : url_link,
	    	"times" : times,
	    	"autho" : autho
		    }
		dicts = json.dumps(dict(dic),ensure_ascii=False)
		line = dicts + '\n'
		self.file.write(line)
		return item
